<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!--bootstrap插件-->
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <link href="/static/plugin/bootstrap/bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="/static/plugin/jo/joUI.css" rel="stylesheet"/>
    <!--字体插件-->
    <link href="/static/plugin/font-awesome-4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
    <link href="/static/plugin/layui-2.4.3/css/layui.css" rel="stylesheet"/>
    <!--ztree-->
    <link href="/static/plugin/zTree/css/metroStyle/metroStyle.css" rel="stylesheet"/>
    <!--common-->
    <link href="/static/css/common.css" rel="stylesheet"/>
    <title>职位意向视图</title>
</head>
<body class="skin-default">

<div class="container-fluid">
    <div class="row">
        <div class="col-xs-12">
            <!--视图块-->
            <div class="container-fluid card">
                <div class="row">
                    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                        <!--检索栏-->
                        <form class="form-inline search-bar" id="pageForm">
                            <div class="form-group">
                                <label class="control-label">主键：&nbsp;</label>
                                <input type="text" name="id" class="form-control">
                            </div>
                            <div class="form-group">
                                <label class="control-label">职位编号：&nbsp;</label>
                                <input type="text" name="jobId" class="form-control">
                            </div>
                            <div class="form-group">
                                <label class="control-label">用户编号：&nbsp;</label>
                                <input type="text" name="userId" class="form-control">
                            </div>
                            <div class="form-group">
                                <label class="control-label">处理结果：&nbsp;</label>
                                <select name="merchantResult" class="form-control">
                                    <option value=""></option>
                                    <option value="同意">同意</option>
                                    <option value="拒绝">拒绝</option>
                                </select>
                            </div>
                            <button type="button" class="btn btn-primary" onclick="joView.select()"> <i class="fa fa-search" aria-hidden="true"></i>&nbsp;查询</button>
                        </form>
                        <!--/检索栏-->
                    </div>
                </div>
                <div class="row">
                    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                        <!--按钮栏-->
                        <div class="form-group button-bar">
                            <button isShow="" type="button" class="btn btn-primary" onclick="joView.add()">
                                <i class="fa fa-plus" aria-hidden="true"></i>&nbsp;新增
                            </button>
                            <button type="button" class="btn btn-danger" onclick="joView.del()">
                                <i class="fa fa-trash-o" aria-hidden="true"></i>&nbsp;删除
                            </button>
                            <button type="button" class="btn btn-warning" onclick="window.location.reload()">
                                <i class="fa fa-refresh" aria-hidden="true"></i>&nbsp;刷新
                            </button>
                        </div>
                        <!--/按钮栏-->
                    </div>
                </div>
                <div class="row">
                    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                        <div class="table-bar">
                            <!--grid-->
                            <div class="table-responsive">
                                <table class="table table-bordered table-hover" id="mainList" dataUrl="/recruit/jobIntention/getPage" deleteUrl="/recruit/jobIntention/delete" formUrl="/page/recruit/jobIntentionForm.html">
                                    <col field="jobName" title="职位" width="25%" align="" event="click" />
                                    <col field="merchantName" title="商户" width="15%" align="" event="click" />
                                    <col field="userName" title="投递用户" width="12%" align=""  />
                                    <col field="[=jo.formatTime('{sendTime}')]" title="投递时间" width="12%" align=""  order="sendTime"/>
                                    <col field="merchantResult" title="处理结果" width="12%" align=""  />
                                    <col field="[=jo.formatTime('{merchantTime}')]" title="处理时间" width="12%" align=""  order="merchantTime"/>
                                    <col field="opt" title="操作" width="12%" align=""/>
                                </table>
                            </div>
                            <!--/grid-->

                            <!--分页条-->
                            <div class="page-bar" gridId="mainList">

                            </div>
                            <!--/分页条-->
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>
</div>

<!--配置信息-->
<script src="/static/js/config.js"></script>
<!--jquery-->
<script src="/static/plugin/jquery/jquery-3.3.1.js"></script>
<script src="/static/plugin/jquery/jquery.cookie.js"></script>
<!--bootstrap-->
<script src="/static/plugin/bootstrap/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
<!--[if lt IE 9]>
<script src="/static/plugin/other/html5shiv.js"></script>
<script src="/static/plugin/other/respond.min.js"></script>
<![endif]-->
<!--layui-->
<script src="/static/plugin/layui-2.4.3/layui.all.js"></script>
<!--ztree-->
<script src="/static/plugin/zTree/js/jquery.ztree.all.js"></script>
<!--common-->
<script src="/static/js/common.js"></script>
<!--jo-->
<script src="/static/plugin/jo/jo.js"></script>
<script src="/static/plugin/jo/jo-adapt.js"></script>
<script src="/static/plugin/jo/jo-page-view.js"></script>
<script src="/static/plugin/jo/jo-page-form.js"></script>
<script src="/static/plugin/jo/jo-listener.js"></script>
<script type="text/javascript">
    layui.laydate.render({
        elem: '#sendTime' //注册日期控件
    });
    layui.laydate.render({
        elem: '#sendTime2' //注册日期控件
    });
    layui.laydate.render({
        elem: '#merchantTime' //注册日期控件
    });
    layui.laydate.render({
        elem: '#merchantTime2' //注册日期控件
    });
    layui.laydate.render({
        elem: '#finalTime' //注册日期控件
    });
    layui.laydate.render({
        elem: '#finalTime2' //注册日期控件
    });
    $(function(){
        joView.init({grid:$("#mainList"),PKName:"id"});//初始化页面
    });
    //表格渲染时行处理,参数1为当前行的数据对象,参数2为当前行的索引值(最小为0)
    joView.handleItem = function(oItem,iIndex){
        if(oItem.userId){
            oItem.userName = '<a class="cursor-hand" style="color:#4E97D9;cursor:point;" onclick="lookUser(\''+oItem.userId+'\')">'+oItem.userName+'</a>';
        }

        if(!oItem.merchantResult){
            oItem.opt = '<button type="button" class="btn btn-sm btn-success" onclick="agree(\''+oItem.id+'\')"><i class="fa fa-check" aria-hidden="true"></i>&nbsp;同意</button>';
            oItem.opt += '&nbsp;<button type="button" class="btn btn-sm btn-danger" onclick="disagree(\''+oItem.id+'\')"><i class="fa fa-close" aria-hidden="true"></i>&nbsp;拒绝</button>';
        }
        if(oItem.merchantResult == '同意'){
            oItem.merchantResult = '<span class="label label-success">同意</span>';
        }else if(oItem.merchantResult == '拒绝'){
            oItem.merchantResult = '<span class="label label-danger">拒绝</span>';
        }

    };
    //查看用户信息
    function lookUser(id){
        jo.showWin('/page/recruit/userInfo.html?id='+id, '600px', '400px', '用户信息');
    }
    //表格渲染完成后的回调,参数为表格数据(数组对象)
    joView.setGridDataAfter = function(oList){

    };
    /* 关于joView更多回调函数和配置参数可查看jo-page-view.js */
    function agree(id){
        if(!id){
            jo.showErrorMsg('意向无效');
            return;
        }
        jo.confirm('您确定同意此人的投递意向吗?', function(idx){
            jo.postAjax('/recruit/jobIntention/agree', {merchantResult: '同意', id: id}, function(json){
                if(json && json.code == 0){
                    jo.showSuccessMsg('操作成功');
                    joView.reloadCurrentPage();
                }else{
                    jo.showTipsMsg(json.info);
                }
            });
            jo.close(idx);
        });
    }
    function disagree(id){
        if(!id){
            jo.showErrorMsg('意向无效');
            return;
        }
        jo.confirm('您确定拒绝此人的投递意向吗?', function(idx){
            jo.postAjax('/recruit/jobIntention/update', {merchantResult: '拒绝', id: id}, function(json){
                if(json && json.code == 0){
                    jo.showSuccessMsg('操作成功');
                    joView.reloadCurrentPage();
                }else{
                    jo.showTipsMsg(json.info);
                }
            });
            jo.close(idx);
        });
    }
</script>
</body>
</html>
